package com.myself.ssoserver.dto

import com.myself.ssoserver.entity.TriLottery
import java.io.Serializable
import java.math.BigDecimal

data class LotteryDTO (
    val normals: List<Int>,
    val special: Int,
    val money: BigDecimal = BigDecimal(0),
    val comment: String,
): Serializable {
    init {
        require(normals.size == 6) { "必须选择6个主号码" }
    }

    fun toEntity(): TriLottery {

        val t = this
        return TriLottery {
            pick1 =  t.normals[0]
            pick2 =  t.normals[1]
            pick3 =  t.normals[2]
            pick4 =  t.normals[3]
            pick5 =  t.normals[4]
            pick6 =  t.normals[5]
            money =  t.money
            pickSpecial = t.special
            comment =  t.comment
        }
    }
}